#include "BalancerControl.h"

BalancerControl::BalancerControl(){


	inputHandler = shared_ptr<UserInputEventReceiver>(new UserInputEventReceiver());

	device = createDevice( video::EDT_OPENGL, core::dimension2d<u32>(900, 600), 16,
                        false,false, false, inputHandler.get());


	driver = device->getVideoDriver();


};


shared_ptr<BalancerControl> BalancerControl::init(){

	if(!initialized){
		shared_ptr<BalancerControl> singleton = shared_ptr<BalancerControl>(new BalancerControl());
		initialized = true;
		return singleton;
	}
	return shared_ptr<BalancerControl>();
}


void BalancerControl::eventLoop(){

	while(device->run()){

		inputHandler->EndEventProcess();
		

		//after event handling routine



		driver->beginScene();

		//here we draw everything

		driver->endScene();

		inputHandler->StartEventProcess();


		
	}
	device->drop();
	
};
